import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import 'package:search_people/page/dynamic/main/index.dart';
import 'package:search_people/page/dynamic/subs/dynamic_leaders/card.dart';
import 'package:search_people/utils/component/list/table_view.dart';
import 'package:search_people/utils/img_util.dart';
import 'package:search_people/value/topcolors.dart';

class DynamicLeaderPage extends GetView<DynamicController> {
  const DynamicLeaderPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var state = controller.state;
    var data = state.dynamicData[state.titles[state.tc.index]] ?? [];
    var sd = state.swiperData[state.titles[state.tc.index]] ?? [];
    return SmartRefresher(
      onRefresh: controller.onRefresh,
      controller: state.rc,
      child: ListView(
        children: [
          SizedBox(
            height: 200.r,
            child: Swiper(
              itemCount: sd.length,
              itemBuilder: (context, index) {
                return Stack(
                  children: [
                    Positioned.fill(child: loadImage(url: sd[index])),
                    Positioned(
                      bottom: 0,
                      child: Container(
                        alignment: Alignment.centerLeft,
                        padding: EdgeInsets.only(left: 12.r, right: 80.r),
                        width: Get.width,
                        color: Colors.black54,
                        height: 30.r,
                        child: Text(
                          '领导动态',
                          style: TextStyle(
                            color: Colors.white,
                            fontSize: 13.sp,
                          ),
                        ),
                      ),
                    ),
                  ],
                );
              },


              pagination:
                  const SwiperPagination(alignment: Alignment.bottomRight,builder:RectSwiperPaginationBuilder(
                    size: Size(20, 8),
                    activeSize: Size(20, 8),
                    activeColor: Colors.blueAccent

                  ),),
            ),
          ),
          Column(
            children: data.map((e) => DynamicCardWidget(md: e)).toList(),
          )
        ],
      ),
    );
  }
}

/**


 */